<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>LiftSimu: /Users/alrik/Documents/workspace/LiftSimu/src/PopupFrame.java Quellcode</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="up.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">LiftSimu
   
   </div>
   <div id="projectbrief">die Simulation einer Liftanlage</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Erzeugt von Doxygen 1.8.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Suchen');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Hauptseite</span></a></li>
      <li><a href="annotated.html"><span>Klassen</span></a></li>
      <li class="current"><a href="files.html"><span>Dateien</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Suchen" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Auflistung&#160;der&#160;Dateien</span></a></li>
    </ul>
  </div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Alle</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Klassen</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Dateien</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Funktionen</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variablen</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">/Users/alrik/Documents/workspace/LiftSimu/src/PopupFrame.java</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_popup_frame_8java.html">gehe zur Dokumentation dieser Datei</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="keyword">import</span> java.awt.*;
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="keyword">import</span> javax.swing.*;
<a name="l00004"></a>00004 
<a name="l00005"></a>00005 <span class="keyword">import</span> layout.TableLayout;
<a name="l00006"></a>00006 
<a name="l00023"></a>00023 @SuppressWarnings(<span class="stringliteral">&quot;serial&quot;</span>)
<a name="l00024"></a><a class="code" href="class_popup_frame.html">00024</a> public class <a class="code" href="class_popup_frame.html" title="Popup um Personen von 0-14 einsteigen zu lassen.">PopupFrame</a> extends JFrame{
<a name="l00025"></a><a class="code" href="class_popup_frame.html#ae7f28db1694fe9edc2504440babb45eb">00025</a>    JButton <a class="code" href="class_popup_frame.html#ae7f28db1694fe9edc2504440babb45eb">bPopupOK</a>;
<a name="l00026"></a><a class="code" href="class_popup_frame.html#a9b6610c6aafb63413236c31cc062b9db">00026</a>    JButton <a class="code" href="class_popup_frame.html#a9b6610c6aafb63413236c31cc062b9db">bPopupCancel</a>;
<a name="l00027"></a><a class="code" href="class_popup_frame.html#a76e4255b89ac17aca59624966ed17d03">00027</a>    JSpinner <a class="code" href="class_popup_frame.html#a76e4255b89ac17aca59624966ed17d03">sAnzahl</a>;
<a name="l00028"></a><a class="code" href="class_popup_frame.html#acc6ea907251eff5e9cb946aa2d02f06c">00028</a>    <span class="keyword">private</span> JLabel <a class="code" href="class_popup_frame.html#acc6ea907251eff5e9cb946aa2d02f06c">lPerson</a>;
<a name="l00029"></a><a class="code" href="class_popup_frame.html#a49a6754dc70e56237ea0f7b42136ca6f">00029</a>    <span class="keyword">private</span> JPanel <a class="code" href="class_popup_frame.html#a49a6754dc70e56237ea0f7b42136ca6f">pHead</a>, pCenter, pBottom;
<a name="l00030"></a><a class="code" href="class_popup_frame.html#a7dc9e6c5d16b2f42d3dee6205299821c">00030</a>    <span class="keywordtype">int</span> <a class="code" href="class_popup_frame.html#a7dc9e6c5d16b2f42d3dee6205299821c">etagenwunsch</a>;
<a name="l00031"></a>00031    
<a name="l00032"></a>00032    
<a name="l00036"></a><a class="code" href="class_popup_frame.html#aecc6612e6215cea77d498e7de10bf0a5">00036</a>    <a class="code" href="class_popup_frame.html#aecc6612e6215cea77d498e7de10bf0a5" title="Der Konstruktor.">PopupFrame</a>(){
<a name="l00037"></a>00037       constructorExtend();
<a name="l00038"></a>00038    }
<a name="l00039"></a>00039    
<a name="l00045"></a><a class="code" href="class_popup_frame.html#a6b7fc04a7165b7cc75bf84efb56559e7">00045</a>    <a class="code" href="class_popup_frame.html#a6b7fc04a7165b7cc75bf84efb56559e7" title="Der Konstruktor.">PopupFrame</a>(String title){
<a name="l00046"></a>00046       super(title);
<a name="l00047"></a>00047       constructorExtend();
<a name="l00048"></a>00048    }
<a name="l00049"></a>00049    
<a name="l00056"></a><a class="code" href="class_popup_frame.html#aebf02e4795806bd607f5d7a652115aa9">00056</a>    <span class="keywordtype">void</span> <a class="code" href="class_popup_frame.html#aebf02e4795806bd607f5d7a652115aa9" title="eine Init-Methode">constructorExtend</a>(){
<a name="l00057"></a>00057          
<a name="l00058"></a>00058       setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); <span class="comment">//* Damit das Close-Event abgefangen werden kann;</span>
<a name="l00059"></a>00059       setResizable(<span class="keyword">false</span>);
<a name="l00060"></a>00060       
<a name="l00061"></a>00061       <span class="comment">// Label konfigurieren</span>
<a name="l00062"></a>00062       lPerson =<span class="keyword">new</span> JLabel(<span class="stringliteral">&quot;Wieviele Personen wollen einsteigen?&quot;</span>);
<a name="l00063"></a>00063       
<a name="l00064"></a>00064       <span class="comment">// Spinner konfigurieren</span>
<a name="l00065"></a>00065       sAnzahl=<span class="keyword">new</span> JSpinner( <span class="keyword">new</span> SpinnerNumberModel(1, 1, 14, 1) );
<a name="l00066"></a>00066       ((JSpinner.DefaultEditor) sAnzahl.getEditor()).getTextField().setEditable(<span class="keyword">false</span>);
<a name="l00067"></a>00067       sAnzahl.setPreferredSize(<span class="keyword">new</span> Dimension(120,20));
<a name="l00068"></a>00068       
<a name="l00069"></a>00069       <span class="comment">// Buttons konfigurieren</span>
<a name="l00070"></a>00070       bPopupOK = <span class="keyword">new</span> JButton(<span class="stringliteral">&quot;OK&quot;</span>);
<a name="l00071"></a>00071       bPopupOK.setPreferredSize(<span class="keyword">new</span> Dimension(120,20));
<a name="l00072"></a>00072       bPopupCancel = <span class="keyword">new</span> JButton(<span class="stringliteral">&quot;Abbrechen&quot;</span>);
<a name="l00073"></a>00073       bPopupCancel.setPreferredSize(<span class="keyword">new</span> Dimension(120,20));
<a name="l00074"></a>00074       
<a name="l00075"></a>00075       <span class="comment">// Hauptlayout</span>
<a name="l00076"></a>00076       <span class="keywordtype">double</span>[][] mainTable = <span class="keyword">new</span> <span class="keywordtype">double</span>[][]{
<a name="l00077"></a>00077             {TableLayout.FILL}, <span class="comment">//Spalten</span>
<a name="l00078"></a>00078               {30, TableLayout.FILL, 30, TableLayout.FILL, 30} <span class="comment">//Zeilen</span>
<a name="l00079"></a>00079           };
<a name="l00080"></a>00080       
<a name="l00081"></a>00081       this.setLayout(<span class="keyword">new</span> TableLayout(mainTable));
<a name="l00082"></a>00082       <span class="comment">//pHead.setLayout(tLayout);</span>
<a name="l00083"></a>00083       
<a name="l00084"></a>00084       <span class="comment">// Panels konfigurieren</span>
<a name="l00085"></a>00085       pHead = <span class="keyword">new</span> JPanel();
<a name="l00086"></a>00086       pHead.setLayout(<span class="keyword">new</span> FlowLayout(1)); <span class="comment">// 1 = align CENTER</span>
<a name="l00087"></a>00087       pHead.add(lPerson);
<a name="l00088"></a>00088       <span class="comment">//pHead.setBackground(Color.green);</span>
<a name="l00089"></a>00089       
<a name="l00090"></a>00090       pCenter = <span class="keyword">new</span> JPanel();
<a name="l00091"></a>00091       pCenter.setLayout(<span class="keyword">new</span> FlowLayout(1));
<a name="l00092"></a>00092       pCenter.add(sAnzahl);
<a name="l00093"></a>00093       <span class="comment">//pCenter.setBackground(Color.blue);</span>
<a name="l00094"></a>00094       
<a name="l00095"></a>00095       pBottom = <span class="keyword">new</span> JPanel();
<a name="l00096"></a>00096       pBottom.add(bPopupOK);
<a name="l00097"></a>00097       pBottom.add(bPopupCancel);
<a name="l00098"></a>00098       <span class="comment">//pBottom.setBackground(Color.red);</span>
<a name="l00099"></a>00099       
<a name="l00100"></a>00100       this.add(pHead, <span class="stringliteral">&quot;0,0&quot;</span>);
<a name="l00101"></a>00101       this.add(pCenter, <span class="stringliteral">&quot;0,2&quot;</span>);
<a name="l00102"></a>00102       this.add(pBottom, <span class="stringliteral">&quot;0,4&quot;</span>);
<a name="l00103"></a>00103       this.setSize(300, 140);
<a name="l00104"></a>00104       
<a name="l00105"></a>00105       <span class="comment">//Bei Mac wird das Icon anders erzeugt als auf den anderen OS</span>
<a name="l00106"></a>00106       <span class="keywordflow">if</span>(System.getProperty(<span class="stringliteral">&quot;os.name&quot;</span>).toString().compareTo(<span class="stringliteral">&quot;Mac OS X&quot;</span>)!=0){
<a name="l00107"></a>00107           Image im = Toolkit.getDefaultToolkit().getImage(<span class="stringliteral">&quot;images/up_highres.png&quot;</span>);
<a name="l00108"></a>00108           setIconImage(im);
<a name="l00109"></a>00109        }
<a name="l00110"></a>00110       
<a name="l00111"></a>00111       placeScreenMid(<span class="keyword">this</span>);
<a name="l00112"></a>00112       <span class="comment">//this.setVisible(true); rausgenommen, damit wir actions zuweisen können, aber das fenster noch nicht erscheint</span>
<a name="l00113"></a>00113    }
<a name="l00114"></a>00114    
<a name="l00120"></a><a class="code" href="class_popup_frame.html#a136ff5fd225eed4f9b07ed6534aa0330">00120</a>    <span class="keyword">public</span> <span class="keywordtype">int</span> <a class="code" href="class_popup_frame.html#a136ff5fd225eed4f9b07ed6534aa0330" title="Der Konstruktor.">getEtage</a>(){
<a name="l00121"></a>00121       <span class="keywordflow">return</span> etagenwunsch;
<a name="l00122"></a>00122    }
<a name="l00123"></a>00123    
<a name="l00129"></a><a class="code" href="class_popup_frame.html#a045c975e0a8cd0971bc1efbc79c2bb32">00129</a>    <span class="keyword">public</span> <span class="keywordtype">int</span> <a class="code" href="class_popup_frame.html#a045c975e0a8cd0971bc1efbc79c2bb32" title="Der Konstruktor.">getAnz</a>(){
<a name="l00130"></a>00130       <span class="keywordflow">return</span> (Integer) sAnzahl.getValue();
<a name="l00131"></a>00131    }
<a name="l00132"></a>00132    
<a name="l00140"></a><a class="code" href="class_popup_frame.html#a8680846e40695335c7d35c1c43627590">00140</a>    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="class_popup_frame.html#a8680846e40695335c7d35c1c43627590" title="Der Konstruktor.">setEtage</a>(<span class="keywordtype">int</span> etage){
<a name="l00141"></a>00141       etagenwunsch=etage;
<a name="l00142"></a>00142       this.setTitle(Integer.toString(etagenwunsch)+<span class="stringliteral">&quot;.Etage&quot;</span>);
<a name="l00143"></a>00143       this.sAnzahl.setValue(1);
<a name="l00144"></a>00144    }
<a name="l00145"></a>00145    
<a name="l00153"></a><a class="code" href="class_popup_frame.html#a44bf30804a07e48c9dcbbfcfcba6cf95">00153</a>    <span class="keywordtype">void</span> <a class="code" href="class_popup_frame.html#a44bf30804a07e48c9dcbbfcfcba6cf95" title="Fenster-zentrier-Funktion.">placeScreenMid</a>( JFrame Frame){
<a name="l00154"></a>00154       Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
<a name="l00155"></a>00155       Dimension windowSize = this.getSize();
<a name="l00156"></a>00156             
<a name="l00157"></a>00157       Frame.setLocation(( (screenSize.width  - windowSize.width ) / 2), ((screenSize.height - windowSize.height) / 2) );   
<a name="l00158"></a>00158    }
<a name="l00159"></a>00159 }
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Erzeugt am Fre Jul 6 2012 16:05:55 für LiftSimu von &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>

</body>
</html>
